package ma.ac.onousc.gestionfi.EngagementPaiement.model;

import java.io.Serializable;
import java.util.List;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;


@Entity
@NamedQuery(name = "Prestation.findByTypePrestation", query = "select pres from Prestation pres where pres.typePrestation=:type")
public class Prestation implements Serializable {

	private static final long serialVersionUID = 1L;
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private int idPrestation;
	private double montantPrestation;
	private String intitulePrestation;

	@OneToMany(mappedBy = "prestation")
	private List<Engagement> engagement;

	@ManyToOne(fetch = FetchType.EAGER)
	private TypePrestation typePrestation;
	
	

	public Prestation(double montantPrestation, String intitulePrestation) {
		super();
		this.montantPrestation = montantPrestation;
		this.intitulePrestation = intitulePrestation;
	}

	public Prestation() {
		super();
		// TODO Auto-generated constructor stub
	}

	public int getIdPrestation() {
		return idPrestation;
	}

	public void setIdPrestation(int idPrestation) {
		this.idPrestation = idPrestation;
	}

	public double getMontantPrestation() {
		return montantPrestation;
	}

	public void setMontantPrestation(double montantPrestation) {
		this.montantPrestation = montantPrestation;
	}

	public String getIntitulePrestation() {
		return intitulePrestation;
	}

	public void setIntitulePrestation(String intitulePrestation) {
		this.intitulePrestation = intitulePrestation;
	}

	public List<Engagement> getEngagement() {
		return engagement;
	}

	public void setEngagement(List<Engagement> engagement) {
		this.engagement = engagement;
	}

	public TypePrestation getTypePrestation() {
		return typePrestation;
	}

	public void setTypePrestation(TypePrestation typePrestation) {
		this.typePrestation = typePrestation;
	}

}
